﻿using System;

namespace CalmNine.Framework 
{
    public class EventValUnRegister<T> : IUnRegister
    {
        public EventValUnRegister(EventVal<T> bindableProperty, Action<T> onValueChanged)
        {
            Val = bindableProperty;
            OnValueChanged = onValueChanged;
        }

        private EventVal<T> Val { get; set; }

        private Action<T> OnValueChanged { get; set; }

        public void UnRegister()
        {
            Val.UnRegister(OnValueChanged);
            Val = null;
            OnValueChanged = null;
        }
    }
}